package com.xu.sso.server.controller;

import com.xu.sso.core.exception.SSOException;
import com.xu.sso.core.utils.ExceptionUtil;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;

public class BaseController {

    protected void validParams(BindingResult bindingResult) throws SSOException {
        if (bindingResult.hasErrors()) {
            FieldError fieldError = bindingResult.getFieldError();
            throw ExceptionUtil.createException(fieldError.getDefaultMessage());
        }
    }


}
